package lion.framework.core.install.anno;

import java.lang.annotation.Annotation;

import lion.dev.lang.MapJ;
import lion.framework.core.anno.AnnoProcessor;
import lion.framework.core.anno.AnnotationProcessorManager;
import lion.framework.core.anno.IAnnotationProcessor;
import lion.framework.core.bean.BeanFactory;
import lion.framework.core.install.IInstall;
import lion.framework.core.install.SystemInstaller;

/**
 * 系统安装模块
 * 
 * @author lion
 * @email hl_0074@sina.com
 * @date 2015年3月18日
 */

@AnnoProcessor(Install.class)
public class InstallAnnoProcessor implements IAnnotationProcessor {

	@Override
	public void processe(MapJ ctx, Annotation anno) throws Exception {

		Class<?> clazz = ctx.getE(AnnotationProcessorManager.ANNO_CONTEXT_CLASS);
		if (!IInstall.class.isAssignableFrom(clazz)) { return; }

		SystemInstaller.addInstaller((IInstall) BeanFactory.create(clazz));
	}
}
